<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="UTF-8">
    <title>教师管理</title>
</head>
<body>

<body>

<div th:include="main :: head"></div>

<h1 style="display: flex;justify-content: space-around">教师管理</h1>

<div style="display: flex;justify-content: space-around">

    <div style="display: flex;justify-content: space-around">

        <div style="display: flex;justify-content: space-around">

            <div>

                <table border="1">  <!-- 分页查询 -->
                    <tr th:each="x:${teachers}">
                        <td th:text="${x.uid}"></td>
                        <td th:text="${x.uname}"></td>
                        <td th:text="${x.phone}"></td>
                        <!--<td th:text="${x.pwd}"></td>-->
                        <td>
                            <div style="width: 10vw;height: 10vw">
                                <img style="height: 90%;width: 100%"
                                     th:src="'/public/showimg/'+${x.pic}"/>
                            </div>
                        </td>
                        <td ><a th:href="'/adm/teacher/go2update/'+ ${x.uid}">更改</a></td>
                        <td ><a th:href="'/adm/teacher/del/'+ ${x.uid}">删除</a></td>
                    </tr>
                </table>

                <a th:href="'/adm/teacher/prevpage?curpage='+${curpage}">上一页</a>
                <a th:text="${curpage}"></a> / <a th:text="${page}"></a>
                <a th:href="'/adm/teacher/nextpage?curpage='+${curpage}">下一页</a>

            </div>

        </div>


    </div>

    <div style="display: flex;justify-content: space-around">

        <a href="/adm/teacher/go2add">添加一位新教师</a>

        <br>

        <div th:if="${noimg}=='添加失败-没有上传图片'">
            <h2 th:text="${noimg}"></h2>
        </div>

        <div th:if="${action}=='add'">

            <h3 th:text="${actmsg}"></h3>


            <div th:if="${noimg}=='添加失败'">
                <h3 th:text="${noimg}"></h3>
            </div>

            <div th:if="${yesimg}=='添加成功'">
                <h3 th:text="${yesimg}"></h3>
            </div>

            <br>
            <br>

            <form action="/adm/teacher/add" method="post" enctype="multipart/form-data">
                编号：<input type="text" name="id" value="0" readonly><br>
                名称：<input type="text" name="uname"><br>
                电话：<input type="text" name="phone"><br>
                密码：<input type="text" name="pwd"><br>
                图片：<input name="img" type="file"/><br>
                <input type="submit" th:value="${actmsg}"/>
            </form>

        </div>

        <div th:if="${action}=='update'">

            <h3 th:text="${actmsg}"></h3>

            <form action="/adm/teacher/update" method="post" enctype="multipart/form-data">
                编号：<input type="text" name="uid" th:value="${oneUser.uid}" readonly><br>
                名称：<input type="text" name="uname" th:value="${oneUser.uname}"><br>
                电话：<input type="text" name="phone" th:value="${oneUser.phone}"><br>
                密码：<input type="text" name="pwd" th:value="${oneUser.pwd}"><br><br>

                <div style="width: 10vw;height: 10vw">
                    <img style="height: 90%;width: 100%" th:src="'/public/showimg/'+${oneUser.pic}"/>
                </div><br><br>

                图片 ： <input name="img" type="file"/><br>
                <br>

                <input type="submit" th:value="${actmsg}"/>
            </form>



        </div>



    </div>



</div>


</body>


</body>
</html>